//
//  LSZMoveCollectionViewCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2017/9/13.
//  Copyright © 2017年 LC. All rights reserved.
//

#import "LSZMoveCollectionViewCell.h"

@implementation LSZMoveCollectionViewCell
-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UIView * viewLow = [[UIView alloc]init];
        viewLow.backgroundColor = [UIColor whiteColor];
        [viewLow bringSubviewToFront:self.imagePicture];
        [viewLow.layer setMasksToBounds:YES];
        [viewLow.layer setCornerRadius:4];
        [self insertSubview:viewLow atIndex:0];

        self.imagePicture = [[UIImageView alloc] init];
        self.imagePicture.contentMode = UIViewContentModeScaleAspectFill;
        self.imagePicture.clipsToBounds = YES;
        [viewLow insertSubview:self.imagePicture atIndex:1];

        self.imageViewErJi = [[UIImageView alloc]init];
        self.imageViewErJi.image = [UIImage imageNamed:@"白耳机"];
        [self.imagePicture addSubview:self.imageViewErJi];

        self.labelClick = [[UILabel alloc]init];
        self.labelClick.textColor = [UIColor whiteColor];
        [self.imagePicture addSubview:self.labelClick];

        self.labelTotal = [[UILabel alloc]init];
        self.labelTotal.font = FONT_12;
        self.labelTotal.textColor = [UIColor whiteColor];
        [self.imagePicture addSubview:self.labelTotal];

        UIImageView * imageViewPlay = [[UIImageView alloc]init];
        imageViewPlay.image = [UIImage imageNamed:@"播放器-播放"];
        [self.imagePicture addSubview:imageViewPlay];

        self.labelName = [[UILabel alloc] init];
        self.labelName.textColor = titleColorLSZ;
        [self addSubview:self.labelName];
        [LSZSpecialPackaging setLabel_14_5_Size:self.labelName];
        [self.labelName sizeToFit];

        self.labelIntroduce = [[UILabel alloc] init];
        self.labelIntroduce.textColor = RGBColor(153, 153, 153);
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelIntroduce font:13];
        [viewLow addSubview:self.labelIntroduce];

        [viewLow mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(0);
            make.right.equalTo(self).offset(0);
            make.left.equalTo(self).offset(0);
            make.bottom.equalTo(self.mas_bottom).offset(0);
        }];
        [self.imagePicture mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.mas_top).offset(0);
            make.left.equalTo(self.mas_left);
            make.right.equalTo(self.mas_right);
            make.height.equalTo(self.imagePicture.mas_width);
        }];


        [self.labelClick mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(20);
            make.height.offset(15);
            make.right.equalTo(self.mas_right).offset(-2);
            make.top.equalTo(self.imagePicture.mas_top).offset(5);
        }];

        [self.imageViewErJi mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(15);
            make.height.offset(15);
            make.right.equalTo(self.labelClick.mas_left).offset(-2);
            make.top.equalTo(self.imagePicture.mas_top).offset(5);
        }];


        [self.labelTotal mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.offset(15);
            make.left.equalTo(self.mas_left).offset(10);
            make.right.equalTo(self.mas_right).offset(-30);
            make.bottom.equalTo(self.imagePicture.mas_bottom).offset(-5);
        }];

        [imageViewPlay mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(20);
            make.height.offset(20);
            make.right.equalTo(self.mas_right).offset(-10);
            make.bottom.equalTo(self.imagePicture.mas_bottom).offset(-5);
        }];
        UIView *bgview = [[UIView alloc] init];
        _bgview = bgview;
        [viewLow addSubview:bgview];
        [bgview mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.imagePicture.mas_bottom).offset(0);
            make.left.equalTo(self.mas_left).offset(6);
            make.right.equalTo(self.mas_right).offset(-6);;
            make.bottom.equalTo(self.mas_bottom);
        }];
        [self.labelName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.imagePicture.mas_bottom).offset(8);
            make.left.equalTo(self.labelIntroduce.mas_left);
            make.right.equalTo(self.labelIntroduce.mas_right);
            make.height.offset(8);
        }];
        [self.labelIntroduce mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.labelName.mas_bottom).offset(10);
            make.right.equalTo(self).offset(-6);
            make.left.equalTo(self).offset(6);
            make.bottom.equalTo(self.mas_bottom).offset(-8);
        }];
    }
    return self;
}
@end
